home *** CD-ROM | disk | FTP | other *** search
-
-
- #ifndef FRGAMELOGO_H
- #define FRGAMELOGO_H
-
- #include <Engine/Engine.h>
-
- #include "FRCar.h"
-
- class FRGameLogo
- {
- public:
-
- static void Start(void);
-
- private:
-
- static void Initialize(void);
- static void Cleanup(void);
- static void Loop(void);
-
- static TESoundReference* ms_pTechno;
- static TESoundReference* ms_pCrash;
- static UInt32 ms_ulLogoStart;
- static UInt32 ms_ulLogoState;
- };
-
- class FRLoserGolf : public FRCar
- {
- TERTTIDeclaration;
-
- public:
-
- FRLoserGolf(TEVector &rCenter, Float fInitYRot)
- { TEOBoundingBox *pOBox = new TEOBoundingBox;
- TEAABoundingBox BBox;
- TEVector Min, Max;
- TEEngine *pEngine = TEEngine::GetEngine();
- TESoundManager* pSound = TESoundManager::GetSoundManager();
- TEString Name;
-
- Name = "motor4.ogg";
- m_pMotor = pSound->GetSound(Name);
- Name = "brake.ogg";
- m_pBraking = pSound->GetSound(Name);
- Name = "horn1.ogg";
- m_pHorn = pSound->GetSound(Name);
-
- m_fMass = 1100.0f;
- m_fElasticity = 0.0f;
- m_fFrictionFactor = 1.0f;
-
- m_fMaxRPM = 6000.0f;
- m_fRotFactor = 0.7f;
-
- m_ulNumGears = 2;
- m_aGears = new FRGearInfo[2];
-
- m_aGears[0].fRPMChange = 1500.0f;
- m_aGears[0].fRPMTrans = -55.0f;
- m_aGears[1].fRPMChange = 2000.0f;
- m_aGears[1].fRPMTrans = 150.0f;
-
- m_Rotation = TEVector(0.0f, fInitYRot, 0.0f);
-
- m_pModelRef = TEModelManager::GetModelManager()->GetModel("crashgolf.tmf");
- TEAssert(m_pModelRef);
-
- m_pModelRef->SetAnimation(0);
- m_pModelRef->SetTimeScale(0);
- m_pModelRef->SetLoopAnimation(true);
-
- BBox = m_pModelRef->GetModelBBox();
- BBox.GetData(Min, Max);
- m_CarSize = Max - Min;
-
- m_Center.m_fX = m_OldCenter.m_fX = rCenter.m_fX;
- m_Center.m_fY = m_OldCenter.m_fY = m_fDeltaY = TEAbs(Min.m_fY);
- m_Center.m_fZ = m_OldCenter.m_fZ = rCenter.m_fZ;
-
- pOBox->SetData(m_Center, Min, Max, m_Rotation);
-
- m_pBoundingVolume = pOBox;
-
- m_fFrontAxis = 0.0f;
- m_fRearAxis = -31.0f;
-
- m_fWheelWidth = 5.5f;
- m_fWheelMov = 3.5f;
-
- m_aLightPos[0] = TEVector(-7.25f, -1.00f, 24.5f);
- m_aLightPos[1] = TEVector( 7.25f, -1.00f, 24.5f);
- m_aLightPos[2] = TEVector(-7.50f, 1.25f, -24.5f);
- m_aLightPos[3] = TEVector( 7.50f, 1.25f, -24.5f);
-
- m_fBrakeEfficiency = 1.0f;
-
- m_usNumExhaust = 1;
- m_aExhaustPos[0] = TEVector(1.8f, -4.0f, -25.0f);
-
- UpdateVectors();
-
- TEVector Center = m_pBoundingVolume->GetCenter();
- TEVector Tmp = Center + m_aExhaustPos[0].m_fX * m_Right +
- m_aExhaustPos[0].m_fY * m_Up + m_aExhaustPos[0].m_fZ * m_Forward;
- m_aExhaust[0] = new TEParticleFX(Tmp, 2, 4, 1.2f, 0, 0, 0, m_Up, 250, 1000,
- 255, 1.0f, true, false);
- m_aExhaust[0]->SetColor(255, 255, 255);
- pEngine->AddParticleSystem(m_aExhaust[0]);
-
- if(m_pMotor != NULL)
- m_pMotor->Play3D(m_Center, m_Velocity, TESOUND_LOOP, 1.0f);
-
- m_bClip = false;
- }
-
- void Brake(void)
- {
- m_bClip = false;
- m_bApplyGravity = false;
- m_fPedal = -1.0f;
- m_pModelRef->SetLoopAnimation(false);
- m_pBraking->Play3D(m_Center, m_Velocity, 0, 1.0f);
- }
-
- void Stop(void)
- {
- m_bClip = false;
- m_bApplyGravity = false;
- m_fPedal = 0;
- m_fCurrentRPM = 0;
- m_lCurrentGear = -1;
- m_Acceleration = m_Velocity = TEVector(0,0,0);
- m_pBraking->Stop();
- Update(1, TEEngine::GetEngine());
- }
- };
-
- class FRCloakLogo : public TEEngineObject
- {
- TERTTIDeclaration;
-
- public:
-
- FRCloakLogo()
- {
- TEString Pak = "logos";
- TEString Name = "fr2";
-
- m_bClip = false;
- m_bTransparency = true;
-
- m_ulLifetime = 0;
- m_pTex = TETextureManager::GetTextureManager()->GetTexture(Name, Pak, false);
- }
-
- ~FRCloakLogo()
- {
- SafeDelete(m_pTex);
- }
-
- protected:
-
- void Animate(UInt32 ulDeltaT, TEEngine* pEngine)
- {
- m_ulLifetime += ulDeltaT;
- }
-
- void Render(TERenderer* pRender, TECamera* pCam)
- {
- UInt32 ulAlpha = m_ulLifetime / 20;
-
- if(ulAlpha > 192)
- ulAlpha = 192;
-
- pRender->SetAmbient(255, 255, 255, (UChar) ulAlpha);
- pRender->EnableBlending();
- pRender->SetBlendingState(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
- pRender->SetTexture(m_pTex);
- pRender->DrawRectanglef(0.15f, 0.2f, 0.85f, 0.8f);
- pRender->DisableBlending();
- }
-
- private:
-
- UInt32 m_ulLifetime;
- TETextureReference* m_pTex;
- };
-
-
- #endif